<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
	<title>词级查询 | ElasticSearch 7.7 权威指南中文版</title>
	<meta name="keywords" content="ElasticSearch 权威指南中文版, elasticsearch 7, es7, 实时数据分析，实时数据检索" />
    <meta name="description" content="ElasticSearch 权威指南中文版, elasticsearch 7, es7, 实时数据分析，实时数据检索" />
    <!-- Give IE8 a fighting chance -->
    <!--[if lt IE 9]>
    <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
    <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
    <![endif]-->
	<link rel="stylesheet" type="text/css" href="../static/styles.css" />
	<script>
	var _link = 'term-level-queries.html';
    </script>
</head>
<body>
<div class="main-container">
    <section id="content">
        <div class="content-wrapper">
            <section id="guide" lang="zh_cn">
                <div class="container">
                    <div class="row">
                        <div class="col-xs-12 col-sm-8 col-md-8 guide-section">
                            <div style="color:gray; word-break: break-all; font-size:12px;">原英文版地址: <a href="https://www.elastic.co/guide/en/elasticsearch/reference/7.7/term-level-queries.html" rel="nofollow" target="_blank">https://www.elastic.co/guide/en/elasticsearch/reference/7.7/term-level-queries.html</a>, 原文档版权归 www.elastic.co 所有<br/>本地英文版地址: <a href="../en/term-level-queries.html" rel="nofollow" target="_blank">../en/term-level-queries.html</a></div>
                        <!-- start body -->
                  <div class="page_header">
<strong>重要</strong>: 此版本不会发布额外的bug修复或文档更新。最新信息请参考 <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/index.html" rel="nofollow">当前版本文档</a>。
</div>
<div id="content">
<div class="breadcrumbs">
<span class="breadcrumb-link"><a href="index.html">Elasticsearch 权威指南 [7.7]</a></span>
»
<span class="breadcrumb-link"><a href="query-dsl.html">查询领域特定语言(Query DSL)</a></span>
»
<span class="breadcrumb-node">词级查询</span>
</div>
<div class="navheader">
<span class="prev">
<a href="query-dsl-pinned-query.html">« pinned  查询</a>
</span>
<span class="next">
<a href="query-dsl-exists-query.html">exists 查询 »</a>
</span>
</div>
<div class="chapter">
<div class="titlepage"><div><div>
<h2 class="title">
<a id="term-level-queries"></a>词级查询 (term-level query)
</h2>
</div></div></div>
<p>
可以使用<span class="strong strong"><strong>词级查询</strong></span>，根据结构化数据中的精确值来查找文档。

结构化数据的例子包括日期范围、IP地址、价格或产品id。
</p>
<p>
与<a class="xref" href="full-text-queries.html" title="Full text queries">全文查询</a>不同，词级查询不分析用于搜索的词项。

相反，词级查询与存储在字段中的确切词项相匹配。
</p>
<div class="note admon">
<div class="icon"></div>
<div class="admon_content">
<p>
词级查询仍然使用 <code class="literal">normalizer</code> 属性对 <code class="literal">keyword</code> 字段的搜索词项进行归一化。

有关信息请参考 <a class="xref" href="normalizer.html" title="normalizer" rel="nofollow"><code class="literal">normalizer</code></a>。
</p>
</div>
</div>
<h3>
<a id="term-level-query-types"></a>词项级别查询的类型
</h3>
<div class="variablelist">
<dl class="variablelist">
<dt>
<span class="term">
<a class="xref" href="query-dsl-exists-query.html" title="Exists 查询" rel="nofollow"><code class="literal">exists</code> 查询</a>
</span>
</dt>
<dd>
返回包含任何字段索引值的文档。
</dd>
<dt>
<span class="term">
<a class="xref" href="query-dsl-fuzzy-query.html" title="Fuzzy 查询" rel="nofollow"><code class="literal">fuzzy</code> 查询</a>
</span>
</dt>
<dd>
返回包含与搜索词项相似的词项的文档。

Elasticsearch 使用<a href="http://en.wikipedia.org/wiki/Levenshtein_distance" class="ulink" target="_top" rel="nofollow">莱温斯坦编辑距离</a>来度量相似性或模糊性。
</dd>
<dt>
<span class="term">
<a class="xref" href="query-dsl-ids-query.html" title="IDs"><code class="literal">ids</code> 查询</a>
</span>
</dt>
<dd>
根据<a class="xref" href="mapping-id-field.html" title="_id field" rel="nofollow">文档id</a>返回文档。
</dd>
<dt>
<span class="term">

<a class="xref" href="query-dsl-prefix-query.html" title="Prefix query" rel="nofollow"><code class="literal">prefix</code> 查询</a>
</span>
</dt>
<dd>
返回在指定的字段中包含特定前缀的文档。
</dd>
<dt>
<span class="term">
<a class="xref" href="query-dsl-range-query.html" title="Range query" rel="nofollow"><code class="literal">range</code> 查询</a>
</span>
</dt>
<dd>
返回包含给定范围内的词项的文档。
</dd>
<dt>
<span class="term">
<a class="xref" href="query-dsl-regexp-query.html" title="Regexp query" rel="nofollow"><code class="literal">regexp</code> 查询</a>
</span>
</dt>
<dd>
返回包含匹配<a href="https://en.wikipedia.org/wiki/Regular_expression" class="ulink" target="_top" rel="nofollow">正则表达式</a>的词项的文档。
</dd>
<dt>
<span class="term">
<a class="xref" href="query-dsl-term-query.html" title="Term query" rel="nofollow"><code class="literal">term</code> 查询</a>
</span>
</dt>
<dd>
返回在指定的字段中包含精确词项的文档。
</dd>
<dt>
<span class="term">
<a class="xref" href="query-dsl-terms-query.html" title="Terms query" rel="nofollow"><code class="literal">terms</code> 查询</a>
</span>
</dt>
<dd>
返回在指定的字段中包含一个或多个精确词项的文档。
</dd>
<dt>
<span class="term">
<a class="xref" href="query-dsl-terms-set-query.html" title="Terms set query" rel="nofollow"><code class="literal">terms_set</code> 查询</a>
</span>
</dt>
<dd>
返回在指定的字段中包含最少数量精确词项的文档。

可以使用字段或脚本定义匹配词项的最小数量。
</dd>
<dt>
<span class="term">
<a class="xref" href="query-dsl-type-query.html" title="Type Query" rel="nofollow"><code class="literal">type</code> 查询</a>
</span>
</dt>
<dd>
返回指定类型的文档。
</dd>
<dt>
<span class="term">
<a class="xref" href="query-dsl-wildcard-query.html" title="Wildcard query" rel="nofollow"><code class="literal">wildcard</code> 查询</a>
</span>
</dt>
<dd>
返回包含匹配通配符模式的词项的文档。
</dd>
</dl>
</div>











</div>
<div class="navfooter">
<span class="prev">
<a href="query-dsl-pinned-query.html">« pinned  查询</a>
</span>
<span class="next">
<a href="query-dsl-exists-query.html">exists 查询 »</a>
</span>
</div>
</div>

                  <!-- end body -->
                        </div>
                        <div class="col-xs-12 col-sm-4 col-md-4" id="right_col">
                        
                        </div>
                    </div>
                </div>
            </section>
        </div>
    </section>
</div>
<script src="../static/cn.js"></script>
</body>
</html>